﻿using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data;

namespace Square.Activity.ActivityTest2
{
    [ToolboxItemAttribute(false)]
    public class ActivityTest2 : Microsoft.SharePoint.WebPartPages.WebPart
    {
        Button btnTest;
        DataSet ds = null;
        protected override void CreateChildControls()
        {
            btnTest = new Button();
            btnTest.Text = "테스트";
            btnTest.Click += new EventHandler(btnTest_Click);
            Controls.Add(btnTest);
        }

        void btnTest_Click(object sender, EventArgs e)
        {
            SquareActivityHelper sHelper = new SquareActivityHelper();
            ds = new DataSet();
            ds = sHelper.actTest(this.Page);
        }

        protected override void Render(HtmlTextWriter writer)
        {
            if (ds != null)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    writer.WriteLine(dr[0] + " : " + dr[1]);
                    writer.WriteLine("</br>");
                }
            }
            base.Render(writer);
        }
    }
}
